package cn.zero.authorize;

import java.io.Serializable;

import cn.zero.http.session.HttpSessionUtil;
import cn.zero.model.User;

public class Authorize implements Serializable {

	private static final long serialVersionUID = 1L;

	public static final String LOGIN_INFO_NAME = "loginInfo";

	public static void setLoginInfo(User user) {
		LoginInfo loginInfo = new LoginInfo();
		loginInfo.setMobile(user.getMobile());
		loginInfo.setUserId(user.getId());
		HttpSessionUtil.setSessionAttribute(LOGIN_INFO_NAME, loginInfo);
	}
	
	public static LoginInfo getLoginInfo() {
		LoginInfo loginInfo = (LoginInfo) HttpSessionUtil.getSessionAttribute(LOGIN_INFO_NAME);
		if (loginInfo == null) {
			loginInfo = new LoginInfo();
		}
		return loginInfo;
	}
	

	
}
